import request from '@/api/request.js'

// 获取所有的菜品类别
export function getAllCategory({page=1, limit=10}) {
    return request.get(`/category?page=${page}&limit=${limit}`)
}

// 创建菜品类别
export function createCategory(data) {
    return request.post('/category', data)
}

// 更新菜品类别
export function updateCategory(id, data) {
    return request.put(`/category/${id}`, data)
}

// 删除菜品类别
export function deleteCategoryById(id) {
    return request.delete(`/category/${id}`)
}

// 查找指定的菜品类别
export function getCategoryById(id) {
    return request.get(`/category/${id}`)
}


// 查找指定餐厅下的所有菜品类别
export function getCategoryByRestaurantId({id, page=1, limit=10}) {
    return request.get(`/category/restaurant/${id}?page=${page}&limit=${limit}`)
}
